<div>
    <form class="form-horizontal bv-form"  role="form"  id="updateForm">
        <input type="hidden" name="project_id" value="{$res.project_id}">
        <fieldset>
            <legend>基本信息</legend>
            <div class="form-group">
                <label class="col-sm-3 control-label">课程名称</label>
                <div class="col-sm-5">
                    <input type="text"  class="form-control" id="project_name" name="project_name" value="{$res.project_name}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">课程简介</label>
                <div class="col-sm-5">
                    <textarea class="form-control" rows="5" name="project_introduction">{$res.project_introduction}</textarea>
                </div>
            </div>
            {if $res['project_team_id']!=''}
            <div class="form-group">
                <label class="col-sm-3 control-label">课程类型</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control project_type" id="project_type" name="project_type" style="width:200px;height:32px;">
                        {volist name="data_type" id="vo" key="k"}
                        <option value="{$k}" {if $k==$res['project_type']} selected="selected" {/if}>{$vo}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">课程分类</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control " id="type_img" name="type" style="width:200px;height:32px;">
                        {if $res['project_type']==1}
                        <option value="1" {if $res['project_banner_img']!=''} selected="selected" {/if} >Banner课程(360*150)</option>
                        <option value="2" {if $res['project_main_img']!=''} selected="selected" {/if} >课程(115*85)</option>
                        {else /}
                        <option value="2" {if $res['project_main_img']!=''} selected="selected" {/if} >课程(115*85)</option>

                        {/if}
                    </select>
                </div>
            </div>
            {else /}
            <div class="form-group">
                <label class="col-sm-3 control-label">课程类型</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control project_type" id="project_type" name="project_type" style="width:200px;height:32px;">
                        <option value="2">公共课程</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">课程分类</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control " id="type_img" name="type" style="width:200px;height:32px;">
                        <option value="2">课程(115*85)</option>
                    </select>
                </div>
            </div>
            {/if}
            <div class="form-group">
                <label class="col-sm-3 control-label yl">上传图像</label>
                <div class="col-sm-5">
                    <a href="javascript:;" class="fileImg">选择文件
                        <input type="file" name="fileImg" id="file2" onchange="bbbb(this);">
                    </a>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label ">预览图片</label>
                {if $res['project_banner_img']!=""}
                <div class="col-sm-3 file1_1 androimg_file" id="androimg_file" style="float:left">
                    <img src="{$res.project_banner_img}" height="150" width="150"/>
                </div>
                {else}
                <div class="col-sm-3 file1_1" id="androimg_file" style="float:left">
                    <img src="{$res.project_main_img}" height="150" width="150"/>
                </div>
                {/if}
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">讲师姓名</label>
                <div class="col-sm-5">
                    <input type="text"  class="form-control" id="project_teacher_name" name="project_teacher_name" value="{$res.project_teacher_name}">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">讲师头像</label>
                <div class="col-sm-5">
                    <a href="javascript:;" class="file file1">选择文件
                        <input type="file" name="file" id="file1" onchange="aaaa(this);">
                    </a>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">预览图</label>
                <div class="col-sm-3 file1_1" id="androimg" style="float:left">
                    <img src="{$res.project_teacher_img}" height="150" width="150"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">讲师介绍</label>
                <div class="col-sm-5">
                    <textarea class="form-control" rows="5" name="project_teacher_introduction">{$res.project_teacher_introduction}</textarea>
                </div>
            </div>
        </fieldset>
    </form>

</div>

<script type="text/javascript" charset="utf-8" src="static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">

    function aaaa(file) {
        var prevDiv = document.getElementById('androimg');
        if (file.files && file.files[0])
        {
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150" width="150"/>';
            }
            reader.readAsDataURL(file.files[0]);
        }
        else
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }
    function bbbb(file) {
        var prevDiv = document.getElementById('androimg_file');
        if (file.files && file.files[0])
        {
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150" width="150"/>';
            }
            reader.readAsDataURL(file.files[0]);
        }
        else
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }

    $(".project_type").on('change',function () {
        var project_type = $(this).val();
        $("#type_img").html("");
        var html = '';
        if(project_type==1){
            html ='<option value="1">Banner课程(360*150)</option><option value="2">课程(115*85)</option>';
        }else{
            html ='<option value="2">课程(115*85)</option>';
        }
        $("#type_img").append(html);

    })
</script>




